package main

import (
	"gitee.com/hakwolf/taibak/internal/routers/database"
	"github.com/ying32/govcl/vcl"
	"github.com/ying32/govcl/vcl/types"
	"strings"
)

//::private::
type TFmShiliFormFields struct {
}

func (f *TFmShiliForm) OnSPBTResetClick(sender vcl.IObject) {

}

func (f *TFmShiliForm) OnSPBTOKClick(sender vcl.IObject) {
	//f.SetModalResult(types.MrNone)
	if strings.TrimSpace(f.EDShiLiname.Text()) == "" {
		vcl.ShowMessage("实例名称不能为空！")
		return
	}

	IntIndex := f.CBShiLiType.ItemIndex() + 1
	if IntIndex == database.DSqlNone {
		vcl.ShowMessage("请选择数据库类型")
		return
	} else if IntIndex == database.DSqlserver {
		if f.CBAuthentication.ItemIndex()+1 == DSqlNO {
			vcl.ShowMessage("请选择sql验证方式")
			return
		}
	} else if IntIndex == database.DMysql {

	}
	f.SetModalResult(types.MrOk)
}
